package com.xiaorong.dao;
/*
 * Copyright 2005-2013 shopxx.net. All rights reserved.
 * Support: http://www.shopxx.net
 * License: http://www.shopxx.net/license
 */


import java.io.Serializable;
import java.util.List;

import javax.persistence.LockModeType;

import com.xiaorong.Filter;
import com.xiaorong.Order;
import com.xiaorong.Page;
import com.xiaorong.Pageable;

public interface BaseDao<T, ID extends Serializable> {

	T find(ID id);
	
	List<T> findList(ID... ids);
	
	List<T> findByProperty(String property, Object value);

	T find(ID id, LockModeType lockModeType);

	List<T> findList(Integer first, Integer count, List<Filter> filters, List<Order> orders);

	Page<T> findPage(Pageable pageable);

	long count(Filter... filters);

	void persist(T entity);

	T merge(T entity);

	void remove(T entity);
	
	void remove(ID id);

	void refresh(T entity);

	void refresh(T entity, LockModeType lockModeType);

	ID getIdentifier(T entity);

	boolean isManaged(T entity);

	void detach(T entity);

	void lock(T entity, LockModeType lockModeType);

	void clear();

	void flush();
	

}